package com.tong.springcloud.controller;

import com.tong.springcloud.pojo.Dept;
import com.tong.springcloud.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Xiong Qian
 * @version 1.0
 * @date 2021/7/2 18:08
 */

@RestController
public class DeptController {

    @Autowired
    private DeptService deptService;

    @PostMapping("/dept/add")
    public void addDept(Dept dept){
        deptService.addDept(dept);
    }

    @GetMapping("/dept/queryById/{id}")
    public Dept queryById(@PathVariable("id") Long id){
        return deptService.queryById(id);
    }

    @GetMapping("/dept/list")
    public List<Dept> queryAll(){
        return deptService.queryAll();
    }


}
